package com.holike.crm.fragment.bank;

import android.widget.TextView;

import com.holike.crm.R;
import com.holike.crm.base.BaseFragment;
import com.holike.crm.base.BasePresenter;
import com.holike.crm.base.IntentValue;
import com.holike.crm.base.MyFragment;
import com.holike.crm.bean.BillListBean;

public class BillDetailFragment extends MyFragment {

    public static void start(BaseFragment<?, ?> fragment, BillListBean.PageDataBean bean) {
        IntentValue.getInstance().put("bill-page-data", bean);
        fragment.startFragment(new BillDetailFragment(), true);
    }

    @Override
    protected int getLayoutResourceId() {
        return R.layout.fragment_bill_detail;
    }

    @Override
    protected BasePresenter attachPresenter() {
        return null;
    }

    @Override
    protected void init() {
        super.init();
        setTitle(getString(R.string.bill_list_bill_detail));
        Object obj = IntentValue.getInstance().removeBy("bill-page-data");
        if (obj instanceof BillListBean.PageDataBean) {
            BillListBean.PageDataBean bean = (BillListBean.PageDataBean) obj;
            String datetime = mContext.getString(R.string.tips_date) + textEmpty(bean.getZdate());
            obtain(R.id.tv_bill_detail_date).setText(datetime);
            String operating = mContext.getString(R.string.tips_operating) + textEmpty(bean.getCztxt());
            obtain(R.id.tv_bill_detail_opt).setText(operating);
            String orderNumber = mContext.getString(R.string.tips_order_number) + textEmpty(bean.getBstkd());
            obtain(R.id.tv_bill_detail_order).setText(orderNumber);
            obtain(R.id.tv_bill_list_detail_sqrdd1).setText(textEmptyNumber(bean.getDqrso()));
            obtain(R.id.tv_bill_list_detail_dqrdd_2).setText(textEmptyNumber(bean.getZqcye()));
            obtain(R.id.tv_bill_list_detail_sxed_3).setText(textEmptyNumber(bean.getZhuok()));
            obtain(R.id.tv_bill_list_detail_sxye4).setText(textEmptyNumber(bean.getZflje()));
            obtain(R.id.tv_bill_list_detail_qcye5).setText(textEmptyNumber(bean.getCcjzh()));
            obtain(R.id.tv_bill_list_detail_crmhk6).setText(textEmptyNumber(bean.getHdzkje()));
            obtain(R.id.tv_bill_list_detail_crmflje7).setText(textEmptyNumber(bean.getCcjzq()));
            obtain(R.id.tv_bill_list_detail_ccjzq8).setText(textEmptyNumber(bean.getKoufei()));
            obtain(R.id.tv_bill_list_detail_hdzkje9).setText(textEmptyNumber(bean.getZkyje()));
            obtain(R.id.tv_bill_list_detail_ccjzh10).setText(textEmptyNumber(bean.getZflqc()));
            obtain(R.id.tv_bill_list_detail_kf11).setText(textEmptyNumber(bean.getZfladd()));
            obtain(R.id.tv_bill_list_detail_kyje12).setText(textEmptyNumber(bean.getZfldow()));
            obtain(R.id.tv_bill_list_detail_kscddje13).setText(textEmptyNumber(bean.getZflqm()));
            obtain(R.id.tv_bill_list_detail_cwflqcye14).setText(textEmptyNumber(bean.getZysqc()));
            obtain(R.id.tv_bill_list_detail_cwfldqzj15).setText(textEmptyNumber(bean.getZysfs()));
            obtain(R.id.tv_bill_list_detail_cwfldqjs16).setText(textEmptyNumber(bean.getZysqm()));
        }
    }

    private TextView obtain(int id) {
        return mContentView.findViewById(id);
    }
}
